# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
#
# Old Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Old Contributor: Andrés Cordero <arch@andrew67.com>
# Old Contributor: Jens Pranaitis <jens@chaox.net>

pkgname=mdk3
pkgver=v6
pkgrel=10
pkgdesc='WLAN penetration tool.'
groups=('blackarch' 'blackarch-wireless' 'blackarch-fuzzer'
        'blackarch-exploitation')
url='https://aspj.aircrack-ng.org/'
arch=('x86_64' 'aarch64')
license=('GPL2')
depends=('glibc' 'aircrack-ng')
source=("https://salsa.debian.org/pkg-security-team/$pkgname/-/archive/debian/master/$pkgname-debian-master.tar.bz2")
sha512sums=('79dff994816e78ae1001074f93f266ad7b820cf03c0b2c3e61d9eb73e2a047c9bb912bcfb14f6dec09584c017407bd84fea127a11cc355b5f8a77102ef0ded89')

prepare() {
  cd "$pkgname-debian-master"

  patches=$(cat debian/patches/series)
  for patch in $patches; do
    patch -Np1 -i debian/patches/$patch
  done

  sed "s|-g -O3|${CFLAGS}|g" -i Makefile
  sed 's|sbin|bin|g' -i Makefile
}

build() {
  cd "$pkgname-debian-master"

  make -C osdep
  make
}
package() {
  cd "$pkgname-debian-master"

  make DESTDIR="$pkgdir" PREFIX="/usr" install

  install -Dm 644 docs/*.html -t "$pkgdir/usr/share/doc/$pkgname"
}

